package com.qf.controller;



import com.qf.pojo.Car;
import com.qf.SelfClass.ResponseData1;
import com.qf.service.CarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author Mr.Liu
 * @date 2021/12/15 20:13
 */
@RequestMapping("/car")
@Controller
public class CarController {
    @Autowired
    private CarService carService;

    @ResponseBody
    @RequestMapping("/findCarByMoney")
    public ResponseData1 findCars(@RequestParam("getid") Integer getid,@RequestParam("backid") Integer backid){
        List<Car> cars = carService.findCarsByMoney(getid);
        if(cars!=null){
            return new ResponseData1(1,cars);
        }
        return null;
    }
    @ResponseBody
    @RequestMapping("/findCarByHot")
    public ResponseData1 findCar(@RequestParam("getid") Integer getid,@RequestParam("backid") Integer backid){
        List<Car> cars = carService.findCarsByHot(getid);
        if(cars!=null){
            return new ResponseData1(1,cars);
        }
        return null;
    }
}
